﻿<phone:PhoneApplicationPage
    x:Class="Cineman.MovieDetailsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
        d:DataContext="{d:DesignData SampleData/SampleMovieData.xaml}"
    shell:SystemTray.IsVisible="True" Loaded="PhoneApplicationPage_Loaded">

    <phone:PhoneApplicationPage.Resources>

        <DataTemplate x:Key="MovieDetailsTemplate">
            <ListBoxItem>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="190"/>
                        <ColumnDefinition Width="190"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock TextAlignment="Center" Text="{Binding Time, StringFormat=\{0:T\} }" Grid.Column="0"/>
                    <TextBlock TextAlignment="Center" Text="{Binding Hall}" Grid.Column="1"/>
                </Grid>

            </ListBoxItem>
        </DataTemplate>

    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" >

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{Binding LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <phone:Panorama DataContext="{Binding}" x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <phone:Panorama.Background>
                <ImageBrush ImageSource="{Binding LargePoster}" Opacity="0.3" Stretch="UniformToFill"/>
            </phone:Panorama.Background>
            <phone:Panorama.Title>
                <TextBlock Text="{Binding Title}" Style="{StaticResource PanoramaItemHeaderTextStyle}" Margin="0,12,0,12"/>
            </phone:Panorama.Title>
            <phone:PanoramaItem>
                <Image Source="{Binding LargePosterLocal}" />
            </phone:PanoramaItem>
            <phone:PanoramaItem>

                <ScrollViewer>
                    <StackPanel>
                        <TextBlock Text="{Binding AirDate, StringFormat=\{0:M\}}" Style="{StaticResource PhoneTextNormalStyle}" />
                        <TextBlock Text="{Binding Country}" Style="{StaticResource PhoneTextNormalStyle}" />
                        <TextBlock Text="{Binding Year}" Style="{StaticResource PhoneTextNormalStyle}" />
                        <TextBlock Text="{Binding Director}" Style="{StaticResource PhoneTextNormalStyle}" />
                        <TextBlock Text="{Binding Genre}" Style="{StaticResource PhoneTextNormalStyle}" />
                        <TextBlock Text="{Binding Duration}" Style="{StaticResource PhoneTextNormalStyle}" />
                        <TextBlock Text="{Binding Restriction}" Style="{StaticResource PhoneTextNormalStyle}" />
                        <TextBlock TextWrapping="Wrap" Text="{Binding Description}" Style="{StaticResource PhoneTextNormalStyle}" />
                    </StackPanel>
                </ScrollViewer>
            </phone:PanoramaItem>
            <phone:PanoramaItem>
                <StackPanel>
                    <TextBlock  TextAlignment="Center" Style="{StaticResource PhoneTextTitle3Style}">Airing times</TextBlock>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="190"/>
                            <ColumnDefinition Width="190"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock TextAlignment="Center" Text="Airing time" Grid.Column="0"/>
                        <TextBlock TextAlignment="Center" Text="Hall" Grid.Column="1"/>
                    </Grid>
                    <ListBox 
                    ItemsSource="{Binding AirTimes}"
					ItemTemplate="{StaticResource MovieDetailsTemplate}">
                    </ListBox>
                    <!--<HyperlinkButton NavigateUri="{Binding BuyTicketUrl}">Buy ticket</HyperlinkButton>-->
                </StackPanel>
            </phone:PanoramaItem>
            <!--<phone:PanoramaItem>

            </phone:PanoramaItem>-->
        </phone:Panorama>
        <StackPanel VerticalAlignment="Center" x:Name="Overlay" Visibility="Collapsed">
            <TextBlock HorizontalAlignment="Center">
					<Run Text="Loading ..."/>
            </TextBlock>
            <ProgressBar x:Name="OverlayProgressBar" IsIndeterminate="True" />
        </StackPanel>
    </Grid>

</phone:PhoneApplicationPage>